package service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import model.generate.SvnProject;
import model.vo.PageResult;
import utils.Page;
import dao.generate.SvnProjectDao;

public class SvnProjectBackService{

	SvnProjectDao svnDao = new SvnProjectDao();
	
	//条件查询(分页)
	public PageResult<SvnProject> findCollectionByConditionWithPage(Map<String,Object> paramMap, Integer pageNum, Integer pageSize) {
		Page<SvnProject> page = new Page<SvnProject>(pageNum,pageSize);
		
		String condition = "";
		List<Object> paramList = new ArrayList<Object>();

		String project = (String)paramMap.get("project");
		if(project!=null && project.length()>0){
			condition += " and project like ?";
			paramList.add('%'+project+'%');
		}
		svnDao.findCollectionByConditionWithPage(condition, paramList.toArray(), null, page);
		return new PageResult<SvnProject>(page);
	}
	//保存
		public void save(SvnProject svnproject) {
			svnDao.saveAndCommit(svnproject);
		}
		//更新
		public void update(SvnProject svnproject) {
			svnDao.updateAndCommit(svnproject);
		}
		//删除
		public void delete(SvnProject svnproject){
			svnDao.deleteAndCommit(svnproject);
		}
		//通过id删除记录(可以同时删除多个)
		@SuppressWarnings("all")
		public void deleteByIDs(Integer... ids) {
			svnDao.deleteByIDsAndCommit(ids);
		}
	
}